# coding:utf-8
class Admin::WifiAccountsController < AdminController
	
  respond_to :html, :json

  set_tab :business
  set_tab :wifi_accounts, :sub_nav
  before_filter :setup, only: [:index]

  def index
    @wifi_accounts = WifiAccount.order('id ASC')
	end

  def new
    @wifi_account = WifiAccount.new
  end

  def edit
    @wifi_account = WifiAccount.find params[:id]
  end

  def create
    @wifi_account = WifiAccount.new(params[:wifi_account])
    render :action => :new unless @wifi_account.save
  end

  def update
    @wifi_account = WifiAccount.find params[:id]
    render :action => :edit unless @wifi_account.update_attributes(params[:wifi_account])
  end

  def destroy
    @wifi_account = WifiAccount.find params[:id]
    @wifi_account.destroy
  end

  private

  def setup
    @ways = ["业务","公共热点账号"]
    @left_panel = "layouts/account_widget"
  end
end